//
//  HXMyChatViewController.m
//  KD
//
//  Created by ifly on 16/5/30.
//  Copyright © 2016年 Whx. All rights reserved.
//

#import "HXMyChatViewController.h"
#import "JCHATConversationListViewController.h"
#import "HXPersonListTableViewController.h"

@interface HXMyChatViewController ()
@property (weak, nonatomic) IBOutlet UIButton *chatBtn;
@property (weak, nonatomic) IBOutlet UIButton *personListBtn;
@end

@implementation HXMyChatViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.chatBtn.selected = YES;
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self.chatBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [self.chatBtn setTitleColor:MAINCOLOR forState:UIControlStateSelected];
    [self.personListBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [self.personListBtn setTitleColor:MAINCOLOR forState:UIControlStateSelected];
    JCHATConversationListViewController *chatVc = [[JCHATConversationListViewController alloc]init];
    chatVc.view.frame = CGRectMake(0, 64, HXSCREEN_WIDTH, HXSCREEN_HEIGHT - 54 - 64);
    [self addChildViewController:chatVc];
    [self.view addSubview:chatVc.view];
    HXPersonListTableViewController *personVc = [[HXPersonListTableViewController alloc]init];
    personVc.isInsert = @"yes";
    [self addChildViewController:personVc];
    personVc.view.frame = CGRectMake(0, 64, HXSCREEN_WIDTH, HXSCREEN_HEIGHT - 54 - 64);
    [self.view addSubview:personVc.view];
    [self.view bringSubviewToFront:chatVc.view];
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.navigationController.navigationBar.translucent = YES;
}
- (IBAction)chatBtnClick:(id)sender {
    self.chatBtn.selected = YES;
    self.personListBtn.selected = NO;
    JCHATConversationListViewController *chatVc = self.childViewControllers[0];
    [self.view bringSubviewToFront:chatVc.view];
}
- (IBAction)personListBtnClick:(id)sender {
    self.chatBtn.selected = NO;
    self.personListBtn.selected = YES;
    HXPersonListTableViewController *personVc = self.childViewControllers[1];
    [self.view bringSubviewToFront:personVc.view];
}

@end
